﻿Public Class frmWebQuest
    Dim imagenes(13) As String
    Dim imgActual As Integer = 0
    Dim recursos() As String

    Private Sub frmWebQuest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        llenarImagenes()
        PictureBox1.Image = Image.FromFile(imagenes(imgActual))
        estadoInicial()
        verificarRecursos()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInicio.Click
        imgActual = 0
        PictureBox1.Image = Image.FromFile(imagenes(imgActual))
        estadoInicial()
        verificarRecursos()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFin.Click
        imgActual = 12
        PictureBox1.Image = Image.FromFile(imagenes(imgActual))
        estadoFinal()
        verificarRecursos()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnterior.Click
        If imgActual <> 0 Then
            imgActual = imgActual - 1
            If imgActual = 0 Then
                estadoInicial()
            Else
                estadoMedio()
            End If
            PictureBox1.Image = Image.FromFile(imagenes(imgActual))
        End If
        verificarRecursos()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSiguiente.Click
        If imgActual < 12 Then
            imgActual = imgActual + 1
            If imgActual = 12 Then
                estadoFinal()
            Else
                estadoMedio()
            End If
            PictureBox1.Image = Image.FromFile(imagenes(imgActual))
        End If
        verificarRecursos()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

    End Sub

    'METODOS
    Private Sub llenarImagenes()
        imagenes(0) = rutaImagenes + "WebQuest1.png"
        imagenes(1) = rutaImagenes + "WebQuest2.png"
        imagenes(2) = rutaImagenes + "WebQuest3.png"
        imagenes(3) = rutaImagenes + "WebQuest4.png"
        imagenes(4) = rutaImagenes + "WebQuest5.png"
        imagenes(5) = rutaImagenes + "WebQuest6.png"
        imagenes(6) = rutaImagenes + "WebQuest7.png"
        imagenes(7) = rutaImagenes + "WebQuest8.png"
        imagenes(8) = rutaImagenes + "WebQuest9.png"
        imagenes(9) = rutaImagenes + "WebQuest10.png"
        imagenes(10) = rutaImagenes + "WebQuest11.png"
        imagenes(11) = rutaImagenes + "WebQuest12.png"
        imagenes(12) = rutaImagenes + "WebQuest13.png"
    End Sub

    Private Sub estadoInicial()
        btnInicio.Enabled = False
        btnAnterior.Enabled = False
        btnSiguiente.Enabled = True
        btnFin.Enabled = True
    End Sub

    Private Sub estadoMedio()
        btnInicio.Enabled = True
        btnAnterior.Enabled = True
        btnSiguiente.Enabled = True
        btnFin.Enabled = True
    End Sub

    Private Sub estadoFinal()
        btnInicio.Enabled = True
        btnAnterior.Enabled = True
        btnSiguiente.Enabled = False
        btnFin.Enabled = False
    End Sub

    Private Sub verificarRecursos()
        Select Case imgActual
            Case 0 To 5, 8, 12
                lblRecurso1.Visible = False
                lblRecurso2.Visible = False
                lblRecurso3.Visible = False
                lblRecurso4.Visible = False
                lblRecurso5.Visible = False
                lblEjemplo.Visible = False
                txtEjemplo.Visible = False
                btnEnviar.Visible = False
            Case 6
                lblRecurso1.Text = "Circuitos y Corriente (Video)"
                lblRecurso1.Visible = True
                lblRecurso2.Text = "Circuitos (Wikipedia)"
                lblRecurso2.Visible = True
                lblRecurso3.Text = "Funcionamiento del Circuito" + vbCrLf + "Eléctrico"
                lblRecurso3.Visible = True
                lblRecurso4.Visible = False
                lblRecurso5.Visible = False
                lblEjemplo.Visible = False
                txtEjemplo.Visible = False
                btnEnviar.Visible = False
            Case 7
                lblRecurso1.Text = "Ley de Ohm"
                lblRecurso1.Visible = True
                lblRecurso2.Text = "Resistencias Eléctricas"
                lblRecurso2.Visible = True
                lblRecurso3.Text = "Modelo de Resistencia" + vbCrLf + "Eléctrica"
                lblRecurso3.Visible = True
                lblRecurso4.Text = "Efecto Joule"
                lblRecurso4.Visible = True
                lblRecurso5.Text = "Leyes de Kirchhoff"
                lblRecurso5.Visible = True
                lblEjemplo.Visible = False
                txtEjemplo.Visible = False
                btnEnviar.Visible = False
            Case 9
                lblRecurso1.Text = "Ley de Ohm (Wikipedia)"
                lblRecurso1.Visible = True
                lblRecurso2.Text = "Leyes de Kirchhoff (Wikipedia)"
                lblRecurso2.Visible = True
                lblRecurso3.Visible = False
                lblRecurso4.Visible = False
                lblRecurso5.Visible = False
                lblEjemplo.Visible = False
                txtEjemplo.Visible = False
                btnEnviar.Visible = False
            Case 10
                lblRecurso1.Text = "Cómo armar un circuito"
                lblRecurso1.Visible = True
                lblRecurso2.Visible = False
                lblRecurso3.Visible = False
                lblRecurso4.Visible = False
                lblRecurso5.Visible = False
                lblEjemplo.Visible = False
                txtEjemplo.Visible = False
                btnEnviar.Visible = False
            Case 11
                lblEjemplo.Visible = True
                txtEjemplo.Visible = True
                btnEnviar.Visible = True
        End Select
    End Sub

    Private Sub lblRecurso1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lblRecurso1.LinkClicked
        Select Case imgActual
            Case 6
                System.Diagnostics.Process.Start("http://www.youtube.com/watch?v=aoZUHdm5Elg")
            Case 7
                System.Diagnostics.Process.Start("http://www.youtube.com/watch?v=Z2eeh5iarmc")
            Case 9
                System.Diagnostics.Process.Start("http://es.wikipedia.org/wiki/Ley_de_Ohm")
            Case 10
                System.Diagnostics.Process.Start("http://www.youtube.com/watch?v=CSX3GpCxV0o")
        End Select
    End Sub

    Private Sub btnEnviar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnviar.Click
        If txtEjemplo.Text = "" Then
            MessageBox.Show("No ingreso ningun ejemplo.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Else
            MessageBox.Show("Ejemplo enviado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information)
            txtEjemplo.Enabled = False
            btnEnviar.Enabled = False
        End If
    End Sub

    Private Sub lblRecurso2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lblRecurso2.LinkClicked
        Select Case imgActual
            Case 6
                System.Diagnostics.Process.Start("http://es.wikipedia.org/wiki/Circuito")
            Case 7
                System.Diagnostics.Process.Start("http://www.youtube.com/watch?v=YhoRrIFc8cU")
            Case 9
                System.Diagnostics.Process.Start("http://es.wikipedia.org/wiki/Ley_de_corriente_de_Kirchhoff")
        End Select
    End Sub

    Private Sub lblRecurso3_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lblRecurso3.LinkClicked

        Select Case imgActual
            Case 6
                System.Diagnostics.Process.Start("http://www.asifunciona.com/electrotecnia/af_circuito/af_circuito_1.htm")
            Case 7
                System.Diagnostics.Process.Start("http://www.youtube.com/watch?v=HsAwdPpPbls")
        End Select
    End Sub

    Private Sub lblRecurso4_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lblRecurso4.LinkClicked
        System.Diagnostics.Process.Start("http://www.youtube.com/watch?v=M26AgqRnHVA")
    End Sub

    Private Sub lblRecurso5_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lblRecurso5.LinkClicked
        System.Diagnostics.Process.Start("http://www.youtube.com/watch?v=tZ4BcROOd_c")
    End Sub
End Class